package com.bll.impl.activityAction;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bean.ActivityBean;
import com.bll.Action;
import com.dao.ActivityDao;

public class AddActivityAction implements Action{
	public String execute(HttpServletRequest request,HttpServletResponse response) {
		
		String addTime=request.getParameter("addTime");
		System.out.println("activityTime:"+addTime);
		String address=request.getParameter("address");
		System.out.println("address:"+address);
		String activityInfo=request.getParameter("activityInfo");
		System.out.println("activityInfo:"+activityInfo);
		String title=request.getParameter("title");
		System.out.println("title:"+title);
		String initiator=request.getParameter("initiator");
		//System.out.println("activityTime:"+activityTime);
		
		String tel=request.getParameter("tel");
		System.out.println("activityInfo:"+tel);

		int userId=Integer.parseInt(request.getSession().getAttribute("userId").toString());
		String lujing=request.getParameter("lujing");
		ActivityDao dao=new ActivityDao();
		ActivityBean bean=new ActivityBean();
		bean.setActivityInfo(activityInfo);
		bean.setAddTime(addTime);
		bean.setAddress(address);
		bean.setInitiator(initiator);
		bean.setTitle(title);
		bean.setUserId(userId);
		bean.setTel(tel);
		int n=dao.addActivity(bean);
		if(n>0){
			return lujing+"?lujing=weihuodong.jsp";
		}else{
			return "faqiwhuodong.html";
		}

	}
}
